#!/usr/bin/env bash
sudo yum install -y wget
kibanaver=7.15.2-x86_64
wget -c https://artifacts.elastic.co/downloads/kibana/kibana-$kibanaver.rpm
sudo rpm -ivh kibana-$kibanaver.rpm
## 一尺kibana启动文件中的logging的dest 可能会出问题
sed -i 's%--logging.dest=\"\/var\/log\/kibana\/kibana.log\"%%g' /etc/systemd/system/kibana.service
sudo systemctl daemon-reload
sudo systemctl enable kibana
mkdir -p /data/kibana/logs/
chown -R kibana:kibana /data/kibana/logs/
cat >>/etc/kibana/kibana.yml<<EOF
server.host: "0.0.0.0"
logging.dest: /data/kibana/logs/kibana.log
i18n.locale: "zh-CN"
kibana.index: ".kibana"
elasticsearch.hosts: ["http://localhost:9200"]
EOF
firewall-cmd --zone=public --permanent --add-port=5601/tcp
firewall-cmd --reload
sudo systemctl start kibana